using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using THSLib;using THSERP.BaseProvider;

namespace THSERP.Modules.Report
{
    public partial class RP003 : ReportForm
    {
        public RP003()
        {
            InitializeComponent();
        }

        private void fld_btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void RP003_Load(object sender, EventArgs e)
        {
            //initalize default date is today
            fld_dteSearchFromARInvoiceDate.EditValue = DateTime.Now;
            fld_dteSearchToARInvoiceDate.EditValue = DateTime.Now.AddDays(1);
            fld_dgcARRP003Invoices.Screen = this;
            fld_dgcARRP003Invoices.InitializeControl();
            fld_btnApply_Click(new object(), new EventArgs());
        }

        private void fld_btnApply_Click(object sender, EventArgs e)
        {
            StringBuilder queryBuilder = new StringBuilder();
            queryBuilder.Append(GenerateSearchQuery(THSUtil.GetTableNameFromBusinessObjectType(typeof(ARInvoicesInfo))));
            ARInvoicesController objInvoicesController = new ARInvoicesController();
            DataSet ds = objInvoicesController.GetDataSet(queryBuilder.ToString());
            fld_dgcARRP003Invoices.DataSource = ds.Tables[0];
        }
    }
}